<template>
	<!-- 透明背景 -->
	<view class="cover" catchtouchmove="stopScroll"></view>
</template>

<script>
	export default {
		mounted() {
			// #ifdef H5
			document.body.addEventListener('touchmove', this.scrollEvent, {
				passive: false
			}); //passive 参数不能省略，用来兼容ios和android
			// #endif
		},
		destroyed() {
			// #ifdef H5
			document.body.removeEventListener('touchmove', this.scrollEvent, {
				passive: false
			}); //passive 参数不能省略，用来兼容ios和android
			// #endif
		},
		methods: {
			stopScroll() {
				return
			},
			scrollEvent(e) {
				e.preventDefault();
			}
		}
	}
</script>

<style>
	.cover {
		background: rgba(0, 0, 0, 0.5);
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
	}
</style>
